<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserChangeBankCardRecords extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_change_bank_card_records', function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->comment = '用户换卡记录表';
            $table->increments('id');
            $table->unsignedInteger('user_id')->comment('用户id')->index();
            $table->string('real_name')->comment('持卡人姓名');
            $table->char('phone_num')->comment('预留手机号');
            $table->unsignedInteger('cert_type')->comment('证件类型：1 身份证,2 因私护照,3 因公护照,4 香 港永久性居民身份证,5 澳门永久性居 民身份证,6 港澳居民来往内地通行 证,7 台湾居民来往大陆通行证,8 外国 人永久居住证,9 其他证件');
            $table->string('cert_num')->comment('用户证件号码');
            $table->string('card_num')->comment('用户银行卡号码');
            $table->string('line_number')->comment('联行号');
            $table->string('bank_name')->comment('银行卡信息');
            $table->string('bank_code')->comment('银行编码');
            $table->tinyInteger('purpose')->comment('换卡目的1放款2还款');
            $table->string('loan_id')->default('')->comment('新流订单id，当前只有用户放款需要换卡收款时才会有');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_change_bank_card_records');
    }
}
